import { get } from '@choerodon/inject';

const installDataSet = get('configuration-devops-routes-app-pipeline-copyPipeline:dataSet');

const {
  fields,
  handleDataSetUpdate,
} = installDataSet || {};

export default (seletDs, AppState) => ({
  autoCreate: true,
  fields: fields ? fields(AppState) : [{
    name: 'pageSize',
    type: 'number',
    defaultValue: 20,
  }, {
    name: 'appServiceId',
    type: 'object',
    label: '关联应用服务',
    required: true,
    textField: 'appServiceName',
    valueField: 'appServiceId',
    options: seletDs,
  }],
  events: {
    update: handleDataSetUpdate || (() => {}),
  },
});
